# Maintainer: Eduard Braun <eduard.braun2@gmx.de>

_realname=libvisio
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.1.7
pkgrel=4
pkgdesc="libvisio is a library and a set of tools for reading and converting MS Visio diagram (mingw-w64)"
arch=('any')
license=('MPL2')
url="https://wiki.documentfoundation.org/DLP/Libraries/libvisio"
options=('staticlibs' 'strip')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-boost"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-doxygen"
             "${MINGW_PACKAGE_PREFIX}-cppunit"
             "gperf"
             "perl")
depends=("${MINGW_PACKAGE_PREFIX}-icu"
         "${MINGW_PACKAGE_PREFIX}-libxml2"
         "${MINGW_PACKAGE_PREFIX}-librevenge")
source=(https://dev-www.libreoffice.org/src/${_realname}/${_realname}-${pkgver}.tar.xz)
sha256sums=('8faf8df870cb27b09a787a1959d6c646faa44d0d8ab151883df408b7166bea4c')

prepare() {
  cd ${_realname}-${pkgver}
}

build() {
  [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
  mkdir -p ${srcdir}/build-${MINGW_CHOST}
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static \
    --disable-silent-rules

  make -j1
}

check() {
  cd build-${MINGW_CHOST}
  make -k check
}

package() {
  cd build-${MINGW_CHOST}
  make -j1 DESTDIR="${pkgdir}" install
}
